package qjc.h_二叉树;

import com.二叉树.练习题.TreeNode;

public class h3_翻转二叉树 {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode left = invertTree(root.left);
        TreeNode right = invertTree(root.right);
        TreeNode middle = root.left;
        root.left = root.right;
        root.right = middle;
        return root;
    }
}
